<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="tcal.css" />
<script type="text/javascript" src="tcal.js"></script> 
<script language="JavaScript" type="text/javascript" src="ajaxlibro.js"></script>
<script language="JavaScript" type="text/javascript" src="includes/script1.js"></script>

<title>Documento sin t&iacute;tulo</title>
<script type="text/javascript">

	
function objetoAjax(){
var xmlhttp=false;
try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function pdflibro(fecini,fecfin,html){
	
	var _fechade = document.getElementById('fechade').value; 
	var _fechaa  = document.getElementById('fechaa').value; 
	if(_fechade == "" || _fechaa == "")
	{
		alert("Debe seleccionar un rango de Fechas válido");return;	
	}

	ajax=objetoAjax();
	ajax.open("POST", "PDFlibro.php",true);
	
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4 && ajax.status==200) {
			window.open("PDFlibro.php?fecini="+fecini+"&fecfin="+fecfin+"&html="+html); 
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("fecini="+fecini+"&fecfin="+fecfin+"&html="+html);
}
</script>
<style type="text/css">
<!--
.line {color: #FFFFFF}
.titulosprincipales {	font-family: Calibri;
	font-size: 18px;
	color: #FF9900;
	font-style: italic;
}
div.frmcrono {  background-color: #ffffff;
border: 4px solid #264965;  

-moz-border-radius: 13px;
-webkit-border-radius: 13px;
border-radius: 13px;
-moz-box-shadow: 0px 0px 5px #000000;
-webkit-box-shadow: 0px 0px 5px #000000;
box-shadow: 0px 0px 5px #000000;
width:900px; height:800px;
}
.Estilo7 {font-family: Calibri; font-size: 13px; font-style: italic; }
.Estilo14 {font-family: Calibri; font-size: 12px; color: #333333; font-weight: bold; }
.Estilo12 {font-family: Calibri; font-size: 12px; color: #333333; font-style: italic; }
-->
</style>
<style type="text/css">
<!--
.titubuskar {
	font-family: Calibri;
	font-size: 12px;
	font-weight: bold;
	font-style: italic;
	color: #003366;
}
.titubuskar0 {font-family: Calibri; font-size: 12px; font-style: italic; color: #333333; }
.titubuskar1 {color: #333333}
.reskar2 {font-family: Calibri; font-size: 13px; font-weight: bold; font-style: italic; color: #003366; }
.reskar {font-size: 12px; font-style: italic; color: #333333; font-family: Calibri;}
-->
</style>
</head>

<body>
<div class="frmcrono">
  <table width="900" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="30" bgcolor="#264965"><table width="900" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="33" height="30"><img src="iconos/newproto.png" alt="" width="26" height="26" /></td>
          <td width="354"><span class="titulosprincipales">Indice Cronológico Libros</span></td>
          <td width="484" align="left"><table width="454" border="0" align="right" cellpadding="0" cellspacing="0">
            <tr>
              <td width="239" height="30">&nbsp;</td>
              <td width="80">&nbsp;</td>
              <td width="17"><span class="line">|</span></td>
              <td width="118">&nbsp;</td>
            </tr>
          </table></td>
          <td width="29"><img src="iconos/cerrar.png" width="21" height="20" /></td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td height="19">&nbsp;</td>
    </tr>
    <tr>
      <td align="center"><table width="863" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="824" height="18"><form id="frmescri" name="frmescri" method="post" action="">
            <table width="834" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="87"><span class="Estilo7">De Fecha </span></td>
                <td width="155"><span class="Estilo7">
                  <label>
                  <input name="fechade" type="text" class="tcal" id="fechade" maxlength="12" />
                  </label>
                </span></td>
                <td width="43"><span class="Estilo7">a</span></td>
                <td width="54"><span class="Estilo7">Fecha</span></td>
                <td width="183"><label>
                  <input name="fechaa" type="text" class="tcal" id="fechaa" maxlength="12" />
                </label></td>
                <td width="279"><a href="#" onclick="buscalibcro()"><img src="iconos/buscarclie.png" width="72" height="29" border="0" /></a></td>
                <td width="33">&nbsp;</td>
                <td><a href="#" onclick="pdflibro(document.getElementById('fechade').value,document.getElementById('fechaa').value)
;"><img src="iconos/icon_pdf.png" alt="" width="33" height="31" border="0" /></a></td>
              </tr>
            </table>
                    </form>          </td>
        </tr>
        <tr>
          <td height="9">---------------------------------------------------------------------------------------------------------------------------------------------</td>
        </tr>
        <tr>
          <td><div id="gennn" style="width:850px; height:690px; overflow:auto;">
      <table width="822" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="834"><table width="823" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333" bgcolor="#CCCCCC">
            <tr>
              <td width="79" align="center"><span class="titubuskar0">N° Cronologico</span></td>
              <td width="84" align="center"><span class="titubuskar0">Fecha </span></td>
              <td width="153" align="center"><span class="titubuskar0">Empresa / Cliente</span></td>
              <td width="116" align="center"><span class="titubuskar0">Objeto</span></td>
              <td width="101" align="center"><span class="titubuskar0">N° de Libro</span></td>
              <td width="68" align="center"><span class="titubuskar0">N° de Folio</span></td>
              <td width="101" align="center"><span class="titubuskar0">Tipo de Folio</span></td>
              <td width="73" align="center"><span class="titubuskar0">DNI / RUC</span></td>
              
            </tr>
          </table></td>
        </tr>
        <tr>
          <td><div id="blibro" style="width:848px">
            <?php 
include("conexion.php");


$consulkar=mysql_query("Select * from libros WHERE fecing BETWEEN '$desde' AND '$hasta' order by numlibro asc", $conn) or die(mysql_error());

while($rowkar = mysql_fetch_array($consulkar)){

echo "
<table width='823' border='1' cellpadding='0' cellspacing='0' bordercolor='#333333'>
  <tr>
    <td width='79' align='center'><span class='titubuskar0'>".$rowkar['ano']."-".$rowkar['numlibro']."</span></td>
    <td width='84' align='center'><span class='titubuskar0'>".$rowkar['fecing']."</span></td>
    <td width='153' align='center'><span class='titubuskar0'>"; 
	if ($rowkar['tipper']=="N"){
		echo $rowkar['apepat']." ".$rowkar['apemat']." ".$rowkar['prinom']." ".$rowkar['segnom'];
		} else{
			
			echo $rowkar['empresa'];
			}
	 echo"</span></td>
    <td width='116' align='center'><span class='titubuskar0'>";
	$sqlss=mysql_query("Select * from tipolibro where idtiplib='".$rowkar['idtiplib']."'", $conn) or die(mysql_error());
	$rowss=mysql_fetch_array($sqlss);
	echo $rowss['destiplib'];
	
	echo"</span></td>
    <td width='101' align='center'><span class='titubuskar0'>";
	$sqlssa=mysql_query("Select * from nlibro where idnlibro='".$rowkar['idnlibro']."'", $conn) or die(mysql_error());
	$rowssa=mysql_fetch_array($sqlssa);
	echo $rowssa['desnlibro'];
	
	
	echo"</span></td>
    <td width='68' align='center'><span class='titubuskar0'>".$rowkar['folio']."</span></td>
    <td width='101' align='center'><span class='titubuskar0'>";
	$sqlssd=mysql_query("Select * from tipofolio where idtipfol='".$rowkar['idtipfol']."'", $conn) or die(mysql_error());
	$rowssd=mysql_fetch_array($sqlssd);
	echo $rowssd['destipfol'];
	
	echo"</span></td>
    <td width='73' align='center'><span class='titubuskar0'>".$rowkar['ruc']."</span></td>
    </tr>
</table>";

}
?>
          </div></td>
        </tr>
      </table>
    </div></td>
        </tr>
      </table></td>
    </tr>
  </table>
</div>
</body>

</html>
